<!--
 * @Date: 2019-11-18 15:00:40
 * @LastEditors: Vi卡农
 * @LastEditTime: 2019-11-18 15:01:09
 * @describe: -商圈管理-
 -->
<template>
  <el-card
    shadow="never"
    class="aui-card--fill"
  >
    <div class="mod-dictionary__business}">
      <el-form
        :inline="true"
        :model="dataForm"
        @keyup.enter.native="getDataList()"
      >

        <el-form-item>
          区域：
          <el-select
            v-model="dataForm.districtCode"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in this.$store.state.CityRegion"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          商圈名：
          <el-input
            v-model="dataForm.name"
            clearable
            style="width:160px"
          ></el-input>
        </el-form-item>

        <!-- <el-form-item>
          <el-input
            v-model="dataForm.id"
            placeholder="id"
            clearable
          ></el-input>
        </el-form-item> -->
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <!-- <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item> -->
        <el-form-item>
          <el-button
            v-if="$hasPermission('dictionary:business:save')"
            type="primary"
            @click="addOrUpdateHandle()"
          >{{ $t('add') }}</el-button>
        </el-form-item>
        <!-- <el-form-item>
          <el-button
            v-if="$hasPermission('dictionary:business:delete')"
            type="danger"
            @click="deleteHandle()"
          >{{ $t('deleteBatch') }}</el-button>
        </el-form-item> -->
      </el-form>
      <el-table
        v-loading="dataListLoading"
        :data="dataList"
        border
        style="width: 100%;"
      >
        <!-- <el-table-column
          type="selection"
          header-align="center"
          align="center"
          width="50"
        ></el-table-column> -->
        <!-- <el-table-column
          prop="id"
          label=""
          header-align="center"
          align="center"
        ></el-table-column> -->

        <el-table-column
          prop="districtName"
          label="区县"
          header-align="center"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="business"
          label="商圈"
          header-align="center"
        >
        <template slot-scope="scope">
            <span v-for="(item,index) in scope.row.business" class="metroStationItem">
              {{item.name}}
            </span>
          </template>
        </el-table-column>

        <!-- <el-table-column
          prop="latitude"
          label="经纬度"
          header-align="center"
          align="center"
        ></el-table-column> -->
        <!-- <el-table-column prop="tenantCode" label="城市租户编码" header-align="center" align="center"></el-table-column>
        <el-table-column prop="creator" label="创建者" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createDate" label="创建时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updater" label="修改人" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateDate" label="修改时间" header-align="center" align="center"></el-table-column> -->
        <el-table-column
          :label="$t('handle')"
          fixed="right"
          header-align="center"
          align="center"
          width="150"
        >
          <template slot-scope="scope">
            <el-button
              v-if="$hasPermission('dictionary:business:update')"
              type="text"
              size="small"
              @click="addOrUpdateHandle(scope.row.districtCode)"
            >{{ $t('update') }}</el-button>
            <!-- <el-button
              v-if="$hasPermission('dictionary:business:delete')"
              type="text"
              size="small"
              @click="deleteHandle(scope.row.id)"
            >{{ $t('delete') }}</el-button> -->
          </template>
        </el-table-column>
      </el-table>
      <div class="ZWbox"></div>
      <div class="paginationBox">
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle"
      >
      
      </el-pagination>
      </div>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update
        v-if="addOrUpdateVisible"
        ref="addOrUpdate"
        @refreshDataList="getDataList"
      ></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
import AddOrUpdate from "./business-add-or-update";
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: "/dictionary/business/page",
        getDataListIsPage: true,
        // exportURL: "/dictionary/business/export",
        deleteURL: "/dictionary/business",
        deleteIsBatch: true
      },
      dataForm: {
        districtCode: "",
        name: ""
      }
    };
  },
  components: {
    AddOrUpdate
  }
};
</script>
<style scoped lang="scss">
  .metroStationItem{
    margin-right: 10px;
  }
</style>